package net.bcxuexi.server.stream;

import net.bcxuexi.server.model.SocketModel;

public class StreamData {
	public byte[] data;
	/**
	 * data数据的大小
	 */
	public int total;
	public SocketModel socketModel;
	/**
	 * 此数据来自于哪个proxyConnId，或者此数据需要交给哪个proxyConnId
	 */
	private String proxyConnId;
	

	public byte[] getData() {
		return data;
	}

	public void setData(byte[] data) {
		this.data = new byte[data.length];
		for (int i = 0; i < data.length; i++) {
			this.data[i] = data[i];
		}
	}
	
	public void addData(byte[] data){
		byte newBytes[] = new byte[total+data.length];
		for(int i=0;i<newBytes.length;i++){
			if(i<total){
				newBytes[i] = this.data[i];
			}else{
				newBytes[i] = data[i-total];
			}
		}
		this.data = newBytes;
		this.total = newBytes.length;
	}

	public int getTotal() {
		return total;
	}

	public void setTotal(int total) {
		this.total = total;
	}

	public SocketModel getSocketModel() {
		return socketModel;
	}

	public void setSocketModel(SocketModel socketModel) {
		this.socketModel = socketModel;
	}

	public String getProxyConnId() {
		return proxyConnId;
	}

	public void setProxyConnId(String proxyConnId) {
		this.proxyConnId = proxyConnId;
	}

}
